package com.wallet.crypto.trustapp.ui.setting;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.wallet.crypto.trustapp.R;
import com.wallet.crypto.trustapp.ui.BaseActivity;
import com.wallet.crypto.trustapp.ui.ChoosePrivateKeyActivity;
import com.wallet.crypto.trustapp.ui.widget.adapter.InSettingAdapter;
import com.wallet.crypto.trustapp.ui.widget.entity.SettingItem;
import com.wallet.crypto.trustapp.widget.SpacesItemDecoration;

import java.util.ArrayList;

public class AdvancedSettingActivity extends BaseActivity {

    private static final int[] ITEM_TITLE = {
            R.string.s0024,
    };

    private final ArrayList<SettingItem> mItems = new ArrayList<>();

    private ImageView mClose;
    private TextView mTitle;
    private RecyclerView mRecyclerView;
    private InSettingAdapter mAdapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_settings);
        initView();
    }

    private void initView() {
        mClose = findViewById(R.id.top_icon);
//        mClose.setImageResource();
        mTitle = findViewById(R.id.top_title);
        mTitle.setVisibility(View.VISIBLE);
        mTitle.setText(R.string.s0017);
        mRecyclerView = findViewById(R.id.setting_rev);
        mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
        mRecyclerView.addItemDecoration(new SpacesItemDecoration(10));
        initData();
        mAdapter = new InSettingAdapter(this, mItems);
        mRecyclerView.setAdapter(mAdapter);
        mAdapter.setmOnItemClickListener((view, position) -> {
            Intent intent = new Intent(this, ChangePINActivity.class);
            intent.putExtra("isAmend",false);
            intent.putExtra("tag",0);
            startActivity(intent);
        });
        mClose.setOnClickListener(this::OnCloseListener);
    }

    private void OnCloseListener(View view) {
        finish();
    }

    private void initData() {
        mItems.add(new SettingItem(ITEM_TITLE[0]));
    }

}
